'use strict';

const db = uniCloud.database();
exports.main = async (event, context) => {
	let { keyword } = event;
	// let res = await db.collection("users").where({
	// 	userName: new RegExp(keyword, "ig")
	// }).field({"userName": true, "uuid": true, "currentStudyWordBankId": true}).get();
	
	let res = await db.collection("users").where({
		role: 1,
		userName: new RegExp(keyword, "ig")
	}).field(
		{"userName": true, 
		 "uuid": true, 
		 "currentStudyWordBankId": true}
	).get()
	
	return res;
};
